
/*Create detailed industry recodes*/

#delimit;
gen detind=.;
replace detind=1  if ind_des>=20 & ind_des<=21;
replace detind=2  if ind_des>=10 & ind_des<=11;
replace detind=3  if ind_des>=40 & ind_des<=50;
replace detind=4  if ind_des==60;
replace detind=5  if ind_des>=230 & ind_des<=241;
replace detind=6  if ind_des==242;
replace detind=7  if ind_des>=250 & ind_des<=262;
replace detind=8  if ind_des>=270 & ind_des<=280;
replace detind=9  if ind_des>=281 & ind_des<=300;
replace detind=10 if ind_des==301;
replace detind=11 if ind_des>=310 & ind_des<=332;
replace detind=12 if ind_des>=340 & ind_des<=350;
replace detind=13 if ind_des==351;
replace detind=14 if ind_des==352;
replace detind=15 if ind_des>=360 & ind_des<=370;
replace detind=16 if ind_des>=371 & ind_des<=382;
replace detind=17 if ind_des==390;
replace detind=18 if ind_des>=391 & ind_des<=392;
replace detind=19 if ind_des>=100 & ind_des<=122;
replace detind=20 if ind_des==130;
replace detind=21 if ind_des>=132 & ind_des<=150;
replace detind=22 if ind_des>=151 & ind_des<=152;
replace detind=23 if ind_des>=160 & ind_des<=162;
replace detind=24 if ind_des>=171 & ind_des<=172;
replace detind=25 if ind_des>=180 & ind_des<=192;
replace detind=26 if ind_des>=200 & ind_des<=201;
replace detind=27 if ind_des>=210 & ind_des<=212;
replace detind=28 if ind_des>=220 & ind_des<=222;
replace detind=29 if ind_des>=400 & ind_des<=432;
replace detind=30 if ind_des>=440 & ind_des<=442;
replace detind=31 if ind_des>=460 & ind_des<=472;
replace detind=32 if ind_des>=500 & ind_des<=571;
replace detind=33 if ind_des>=580 & ind_des<=691;
replace detind=34 if ind_des>=700 & ind_des<=710;
replace detind=35 if ind_des>=711 & ind_des<=712;
replace detind=36 if ind_des==761;
replace detind=37 if (ind_des>=721 & ind_des<=722) | (ind_des>=731 & ind_des<=750);
replace detind=38 if ind_des>=751 & ind_des<=760;
replace detind=39 if ind_des>=762 & ind_des<=791;
replace detind=40 if ind_des>=800 & ind_des<=802;
replace detind=41 if ind_des==831;
replace detind=42 if (ind_des>=812 & ind_des<=830) | (ind_des>=832 & ind_des<=840);
replace detind=43 if ind_des>=842 & ind_des<=860;
replace detind=44 if ind_des>=861 & ind_des<=871;
replace detind=45 if ind_des==730 | ind_des==841 | (ind_des>=872 & ind_des<=892);
replace detind=46 if ind_des>=30 & ind_des<=31;
replace detind=47 if ind_des==910;
replace detind=48 if ind_des==922;
replace detind=49 if ind_des==932;
replace detind=50 if ind_des==900 | ind_des==901 | ind_des==921 | ind_des==930 | ind_des==931;
replace detind=51 if ind_des==991;

label def detind
 1 "agriculture service"
 2 "other agriculture"
 3 "mining"
 4 "construction"
 5 "lumber and wood products, except furniture"
 6 "furniture and fixtures"
 7 "stone clay, glass, and concrete product"
 8 "primary metals"
 9 "fabricated metal"
10 "not specified metal industries"
11 "machinery, except electrical"
12 "electrical machinery, equipment, and supplies"
13 "motor vehicles and equipment"
14 "aircraft and parts"
15 "other transportation equipment"
16 "professional and photographic equipment, and watches"
17 "toys, amusements, and sporting goods"
18 "miscellaneous and not specified manufacturing industries"
19 "food and kindred products"
20 "tobacco manufactures"
21 "textile mill products"
22 "apparel and other finished textile products"
23 "paper and allied products"
24 "printing, publishing and allied industries"
25 "chemicals and allied products"
26 "petroleum and coal products"
27 "rubber and miscellaneous plastics products"
28 "leather and leather products"
29 "transportation"
30 "communications"
31 "utilities and sanitary services"
32 "wholesale trade"
33 "retail trade"
34 "banking and other finance"
35 "insurance and real estate"
36 "private household services"
37 "business services"
38 "repair services"
39 "personal services, except private household"
40 "entertainment and recreation services"
41 "hospitals"
42 "health services, except hospitals"
43 "educational services"
44 "social services"
45 "other professional services"
46 "forestry and fisheries"
47 "justice, public order and safety"
48 "administration of human resource programs"
49 "national security and internal affairs"
50 "other public administration"
51 "armed forces"
;

label val detind detind;


/*Create major industry recodes*/

gen majind=.;
replace majind=1  if detind>=1 & detind<=2;
replace majind=2  if detind==3;
replace majind=3  if detind==4;
replace majind=4  if detind>=5 & detind<=18;
replace majind=5  if detind>=19 & detind<=28;
replace majind=6  if detind==29;
replace majind=7  if detind==30;
replace majind=8  if detind==31;
replace majind=9  if detind==32;
replace majind=10 if detind==33;
replace majind=11 if detind>=34 & detind<=35;
replace majind=12 if detind==36;
replace majind=13 if detind>=37 & detind<=38;
replace majind=14 if detind==39;
replace majind=15 if detind==40;
replace majind=16 if detind==41;
replace majind=17 if detind==42;
replace majind=18 if detind==43;
replace majind=19 if detind==44;
replace majind=20 if detind==45;
replace majind=21 if detind==46;
replace majind=22 if detind>=47 & detind<=50;
replace majind=23 if detind==51;

label define majind
 1 "agriculture"
 2 "mining"
 3 "construction"
 4 "manufacturing, durable goods"
 5 "manufacturing, non-durable goods"
 6 "transportation"
 7 "communications"
 8 "utilities and sanitary services"
 9 "wholesale trade"
10 "retail trade"
11 "finance, insurance, and real estate"
12 "private households"
13 "business and repair services"
14 "personal services, except private"
15 "entertainment and recreation services"
16 "hospitals"
17 "medical services, except hospitals"
18 "educational services"
19 "social services"
20 "other professional services"
21 "forestry and fisheries"
22 "public administration"
23 "armed forces"
;

label val majind majind;

#delimit cr

